<div class="rc-pannel rc-pagepadding">

    <form class="layui-form" action="">

        <div class="layui-form-item">
            <label class="layui-form-label">旧密码</label>
            <div class="layui-input-block">
                <input type="password" class="layui-input" name="oldpwd" lay-verify="required" />
            </div>

        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">新密码</label>
            <div class="layui-input-block">
                <input type="password" class="layui-input" name="newpwd" lay-verify="required" />
            </div>

        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">确认新密码</label>
            <div class="layui-input-block">
                <input type="password" class="layui-input" name="renewpwd" lay-verify="required" />
            </div>

        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" class="layui-btn layui-btn-primary" lay-submit lay-filter="submit">确定</button>
                <button type="reset" class="layui-btn ">重置</button>
            </div>

        </div>
    </form>

</div>


<script>
    layui.use(function() {
        var form = layui.form;
        form.on('submit(submit)', function(data) {
            var postdata = data.field;
            $.ajax({
                url: '/uc/Personal/changePwd', //请求路径
                type: "POST", //请求方式
                data: postdata, // 默认写法
                success: function(data) {
                    if (data.code == 0) {
                        toastr_success("修改成功", function() {
                            window.parent.location.reload();
                        });
                    } else {
                        toastr_error(data.message);
                    }
                },
                error: function() {

                },

            });
        });


    });
</script>